<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<link rel="stylesheet" href="src/lunar.css">
<body>
<div></div>
    <div class="lunar"></div>
    <script src="src/lunar.js"></script>
    <script>
        //type 0是加班,1是休息
        var holidays=[
            {name:"春节",plans:[
                {date:"2020/1/24",type:1},
                {date:"2020/1/25",type:1},
                {date:"2020/1/26",type:1},
                {date:"2020/1/27",type:1},
                {date:"2020/1/28",type:1},
                {date:"2020/1/29",type:1},
                {date:"2020/1/30",type:1},
                {date:"2020/1/31",type:1},
                {date:"2020/2/1",type:0},
            ]},
            {name:"清明节",plans:[
                {date:"2020/4/3",type:1},
                {date:"2020/4/4",type:1},
                {date:"2020/4/5",type:1},
                {date:"2020/4/6",type:1}
            ]},
            {name:"劳动节",plans:[
                {date:"2020/4/26",type:0},
                {date:"2020/5/1",type:1},
                {date:"2020/5/2",type:1},
                {date:"2020/5/3",type:1},
                {date:"2020/5/4",type:1},
                {date:"2020/5/5",type:1},
                {date:"2020/5/9",type:0},
            ]},
        ]
    </script>
    <script>
        var lunar=new Lunar(".lunar",new Date());
        //选择时间
        //lunar.render(new Date("2020/4/1"))
        //加载节日安排
        //lunar.setHolidays(holidays)
        //保存事件
        lunar.setHolidays(holidays);
        lunar.onSave=function(oldVal,newVal){
            console.log(oldVal,newVal);
            //保存成功时调这个方法刷新空件
            lunar.success();
            //取消保存时调这个方法刷新空件
            //lunar.cancel();
        }
    </script>
</body>
</html>